import {createApp} from 'vue'
import App from './App.vue'
import {router} from './router'
import 'element-plus/dist/index.css'
import {ElMessage} from 'element-plus'
import store from './store/store'
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'

if(document.body.clientWidth < 500) {
    document.getElementById("app").innerHTML =
        `
            <h1>抱歉！</h1>
            <h2>本网站不支持在移动端工作</h2>
            <h2>请在电脑端打开本网站</h2>
        `
} else {
    const app = createApp(App);

    app.use(router)
    app.use(store)
    app.use(mavonEditor)
    app.config.globalProperties.$goRoute = function (index) {
        this.$router.push(index).catch(e=>console.error(e))
    }
    app.config.globalProperties.$message = ElMessage
    app.config.globalProperties.$success = (msg,duration=3000) => ElMessage({
        showClose: true,
        message: msg,
        type: 'success',
        duration: duration
    })
    app.config.globalProperties.$warning = (msg,duration=3000) => ElMessage({
        showClose: true,
        message: msg,
        type: 'warning',
        duration: duration
    })
    app.config.globalProperties.$error = (msg,duration=3000) => ElMessage({
        showClose: true,
        message: msg,
        type: 'error',
        duration: duration
    })
    app.config.globalProperties.$info = (msg,duration=3000) => ElMessage({
        showClose: true,
        message: msg,
        type: 'info',
        duration: duration
    })

    app.mount('#app')
}


